package com.maiji.cloud.controller.community;

import com.maiji.cloud.controller.BaseController;
import com.maiji.cloud.request.BaseInputDto;
import com.maiji.cloud.request.IdInputDto;
import com.maiji.cloud.response.BaseOutPutDto;
import com.maiji.cloud.response.login.UserInfoResDto;
import com.maiji.cloud.response.shopingmall.FinancialDetailsResData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/community")
@Api(tags = {"社区"})
public class ComPraiseController extends BaseController {

    @PostMapping("/praiseList")
    @ApiOperation("点赞列表")
    public BaseOutPutDto<List<UserInfoResDto.UserInfoResData>>praiseList(@RequestBody BaseInputDto<IdInputDto>inputDto,@RequestHeader("maijiToken")String maijiToken){
        return postForObjectWithToken(maijiToken, REST_URL_PREFIX_COMMUNITY + "/community/praiseList", inputDto, BaseOutPutDto.class);
    }

    @PostMapping("/praise")
    @ApiOperation("动态点赞")
    public BaseOutPutDto<FinancialDetailsResData> praise(@RequestBody BaseInputDto<IdInputDto> inputDto, @RequestHeader("maijiToken")String maijiToken){
        return postForObjectWithToken(maijiToken, REST_URL_PREFIX_COMMUNITY + "/community/praise", inputDto, BaseOutPutDto.class);
    }
    @PostMapping("/cancelPraise")
    @ApiOperation("取消动态点赞")
    public BaseOutPutDto<String> cancelPraise(@RequestBody BaseInputDto<IdInputDto> inputDto, @RequestHeader("maijiToken")String maijiToken){
        return postForObjectWithToken(maijiToken, REST_URL_PREFIX_COMMUNITY + "/community/cancelPraise", inputDto, BaseOutPutDto.class);
    }
}
